From: Aaron Schulz Date: Fri, 7 Dec 2012 03:30:25 +0000 (-0800) Subject: [JobQueue] Added a sanity check to catch ack() breakage. X-Git-Tag: 1.31.0-rc.0~21402^2 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=32b62ebd4b9e0c1bb77f252fc53312c2fbaa8de9;p=lhc%2Fweb%2Fwiklou.git [JobQueue] Added a sanity check to catch ack() breakage. * Also make sure the "id" field is set even if broken subclasses do not set it as the base class does. Change-Id: I2f617187e225df6c1b02b4062c835cd6581c5d99 --- diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php index cf6f1b97cf..ef5c346f3d 100644 --- a/includes/job/JobQueueDB.php +++ b/includes/job/JobQueueDB.php @@ -174,6 +174,7 @@ class JobQueueDB extends JobQueue { } $job = Job::factory( $row->job_cmd, $title, self::extractBlob( $row->job_params ), $row->job_id ); + $job->id = $row->job_id; // XXX: work around broken subclasses // Flag this job as an old duplicate based on its "root" job... if ( $this->isRootJobOldDuplicate( $job ) ) { $job = DuplicateJob::newFromJob( $job ); // convert to a no-op @@ -344,6 +345,10 @@ class JobQueueDB extends JobQueue { * @return Job|bool */ protected function doAck( Job $job ) { + if ( !$job->getId() ) { + throw new MWException( "Job of type '{$job->getType()}' has no ID." ); + } + $dbw = $this->getMasterDB(); $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction